package com.wc.blue_bridge_history.Java14B.D_矩形总面积;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2024/3/11 10:19
 * @description https://www.lanqiao.cn/paper/3872/problem/3536/
 */
public class Main {
    static int x1, y1, x2, y2, x3, y3, x4, y4;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        x1 = sc.nextInt();
        y1 = sc.nextInt();
        x2 = sc.nextInt();
        y2 = sc.nextInt();
        x3 = sc.nextInt();
        y3 = sc.nextInt();
        x4 = sc.nextInt();
        y4 = sc.nextInt();

        // 左边的右边
        int lr = Math.max(x1, x3);
        // 右边的左边
        int rl = Math.min(x2, x4);
        // 上边的下边
        int ud = Math.max(y1, y3);
        // 下边的上边
        int du = Math.min(y2, y4);

        long overlapS = (long) Math.max(0, rl - lr) * Math.max(0, du - ud);
        long res = (long) (x2 - x1) * (y2 - y1) + (long) (x4 - x3) * (y4 - y3) - overlapS;
        System.out.println(res);
    }
}


